from datetime import date

MONTH = {'January' : 1, 'February' : 2, 'March' : 3, 'April' : 4, 'May' : 5, 'June' : 6, 
            'July' : 7, 'August' : 8, 'September' : 9, 'October' : 10, 'November' : 11, 'December' : 12}

dayOfMonth = [0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31]

def isLeap(year):
    if (not(year % 100) and not(year % 400)) or ((year % 100) and not(year % 4)):
        return True
    else:
        return False

def judgeInput(date):
    if len(date) != 2:
        return False

    if not(date[1].isdigit()):
        return False
    else:
        date[1] = int(date[1])
        if (isLeap(date[1])):
            dayOfMonth[2] = 29
        else:
            dayOfMonth[2] = 28

    date[0] = date[0].split()
    if len(date[0]) != 2:
        return False

    if date[0][0].isdigit() and date[0][1] in MONTH:
        date[0][0] = int(date[0][0])
        date[0][1] = MONTH[date[0][1]]
        if date[0][0] > dayOfMonth[date[0][1]] or date[0][0] == 0:
            return False
        else:
            return True
    else:
        return False

if __name__ == '__main__':
    date1 = input('请输入日期 格式为:30 August, 2012\n').split(', ')
    date2 = input().split(', ')

    while not(judgeInput(date1)) or not(judgeInput(date2)):
        print('输入格式错误')
        date1 = input('请输入日期 格式为:30 August, 2012\n').split(', ')
        date2 = input().split(', ')

    date1 = date(date1[1], date1[0][1], date1[0][0])
    date2 = date(date2[1], date2[0][1], date2[0][0])

    #datetime直接减得一个timedelta对象
    print(abs((date2 - date1).days))
    input("Press any key to continue")